USE [influenza]
GO

/****** Object:  StoredProcedure [dbo].[SP_cmbEstudioLab]    Script Date: 02/12/2010 17:04:27 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[SP_cmbEstudioLab]
@nUnidad varchar(3)
as
Begin
declare @qry VARCHAR(8000)
SET @qry='Select distinct t.id_estudio,t.estudio 
from cat_AdminLab a 
inner join cat_lab_estudio t on (a.id_lab_Estudio=t.id_estudio)
inner join Cat_Laboratorio l on (a.id_lab_tipoLab=l.nPerfil)
Where l.id_laboratorio='+@nUnidad+' and a.activo=1'

exec (@qry)	
END
GO

